package org.zhuyx.ch01.factory;

import org.zhuyx.ch01.shili.dao.PetDao;

/**
 * @author 茜茜
 * @date 2024-12-05 13:57
 */
public class PetDaoFactory {
    public static String defaultBeanName="petDaoMySQLImpl";

    public static PetDao getInstance(String beanName){
        PetDao petDao=null;
        switch (beanName){
            case "petDaoMySQLImpl":
                petDao=new org.zhuyx.ch01.shili.dao.impl.PetDaoMysqlImpl();
                break;
            case "petDaoOracleImpl":
                petDao=new org.zhuyx.ch01.shili.dao.impl.PetDaoOracleImpl();
                break;
            default:
                throw new RuntimeException("未找到Bean:"+beanName);
        }
        return petDao;
    }
}
